package com.gxa.meiye.admin.platform.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxa.meiye.admin.platform.mapper.AdminMapper;
import com.gxa.meiye.admin.platform.pojo.vo.AdminVo;
import com.gxa.meiye.admin.platform.pojo.vo.MenuVo;
import com.gxa.meiye.admin.platform.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * @author bill
 * @date 2022/7/1 11:42
 */
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, AdminVo> implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public AdminVo queryAdminByName(String account) {
        AdminVo admin = adminMapper.queryAdminByName(account);
        return admin;
    }

    @Override
    public Set<String> queryPerms(String account) {
        Set<String> perms = adminMapper.queryPerms(account);
        return perms;
    }

    @Override
    public Integer queryAdmin(AdminVo adminVo) {
        Integer integer = adminMapper.queryAdmin(adminVo);
        return integer;
    }

    @Override
    public AdminVo queryAdminById(Integer id) {
        AdminVo adminVo = adminMapper.selectById(id);
        return adminVo;
    }

    @Override
    public List<MenuVo> selPMenu(Integer user_id) {
        List<MenuVo> menuVos = adminMapper.selPMenu(user_id);
        return menuVos;
    }

    @Override
    public List<MenuVo> selSMenu(Integer id) {
        List<MenuVo> menuVos = adminMapper.selSMenu(id);
        return menuVos;
    }

    @Override
    public Integer updatePwd(AdminVo adminVo) {
        int i = adminMapper.updateById(adminVo);
        return i;
    }
}
